package com.vvkee.controller;

import com.vvkee.event.OrderCreateEvent;
import com.vvkee.utils.SpringUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/event")
public class EventController {

    @GetMapping("/create")
    public String create() {
        long id = System.currentTimeMillis();
        OrderCreateEvent event = new OrderCreateEvent(this,
                " 订单 " + id + "创建成功");
        SpringUtil.getApplicationContext().publishEvent(event);
        return "success";
    }
}
